<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="theme-color" content="#33474d">
	<title>Linux 系统下查看raid信息，以及磁盘信息 | 失落的乐章</title>
	<link rel="stylesheet" href="/css/style.css" />
	
      <link rel="alternate" href="/atom.xml" title="失落的乐章" type="application/atom+xml">
    
</head>

<body>

	<header class="header">
		<nav class="header__nav">
			
				<a href="/archives" class="header__link">Archive</a>
			
				<a href="/tags" class="header__link">Tags</a>
			
				<a href="/atom.xml" class="header__link">RSS</a>
			
		</nav>
		<h1 class="header__title"><a href="/">失落的乐章</a></h1>
		<h2 class="header__subtitle">技术面前，永远都是学生。</h2>
	</header>

	<main>
		<article>
	
		<h1>Linux 系统下查看raid信息，以及磁盘信息</h1>
	
	<div class="article__infos">
		<span class="article__date">2017-10-12</span><br />
		
		
			<span class="article__tags">
			  	<a class="article__tag-link" href="/tags/Linux/">Linux</a>
			</span>
		
	</div>

	

	
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;有时想知道服务器上有几块磁盘，如果没有做raid，则可以简单使用fdisk -l  就可以看到。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;但是做了raid呢，这样就看不出来了。那么如何查看服务器上做了raid？</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;软件raid：只能通过Linux系统本身来查看<br>　<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">cat /proc/mdstat</div></pre></td></tr></table></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;可以看到raid级别，状态等信息。<br>　<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;硬件raid： 最佳的办法是通过已安装的raid厂商的管理工具来查看，有cmdline，也有图形界面。如Adaptec公司的硬件卡就可以通过下面的命令进行查看：<br>　<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="comment"># /usr/dpt/raidutil -L all</span></div></pre></td></tr></table></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;可以看到非常详细的信息。<br>　<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;当然更多情况是没有安装相应的管理工具，只能依靠Linux本身的话一般我知道的是两种方式：<br>　<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"><span class="comment"># dmesg |grep -i raid</span></div><div class="line">　</div><div class="line"><span class="comment"># cat /proc/scsi/scsi</span></div></pre></td></tr></table></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;显示的信息差不多，raid的厂商，型号，级别，但无法查看各块硬盘的信息。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如下信息作为案例， 命令为  </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div></pre></td><td class="code"><pre><div class="line"><span class="comment"># fdisk -l </span></div><div class="line">Disk /dev/sda: 145.9 GB, 145999527936 bytes</div><div class="line">255 heads, 63 sectors/track, 17750 cylinders</div><div class="line">Units = cylinders of 16065 * 512 = 8225280 bytes</div><div class="line"></div><div class="line">   Device Boot      Start         End      Blocks   Id  System</div><div class="line">/dev/sda1   *           1          13      104391   83  Linux</div><div class="line">/dev/sda2              14       17750   142472452+  8e  Linux LVM</div><div class="line"></div><div class="line"></div><div class="line"><span class="comment"># cat /proc/scsi/scsi</span></div><div class="line"></div><div class="line">Attached devices:</div><div class="line">Host: scsi0 Channel: 00 Id: 00 Lun: 00</div><div class="line">  Vendor: SEAGATE  Model:  ST3146356SS      Rev: HS09</div><div class="line">  Type:   Direct-Access                    ANSI SCSI revision: 05</div><div class="line">Host: scsi0 Channel: 00 Id: 01 Lun: 00</div><div class="line">  Vendor: SEAGATE  Model: ST3146356SS      Rev: HS09</div><div class="line">  Type:   Direct-Access                    ANSI SCSI revision: 05</div><div class="line">Host: scsi0 Channel: 01 Id: 00 Lun: 00</div><div class="line">  Vendor: Dell     Model: VIRTUAL DISK     Rev: 1028</div><div class="line">  Type:   Direct-Access                    ANSI SCSI revision: 05</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;通过以上信息可以看出，该服务器有两块磁盘。品牌是希捷的，磁盘代号为 ST3146356SS，如果你熟悉细节磁盘的代号命名规则，你会轻易判定该磁盘大小为146G 。再根据fdisk 得出的结果可以判定，该服务器是拿两块146G的硬盘做的raid1.</p>

	

	
		<span class="different-posts"><a href="/2017/10/12/1. Linux 基础/21. Linux 系统下查看raid信息，以及磁盘信息/" onclick="window.history.go(-1); return false;">⬅️ Go back </a></span>

	

</article>

	</main>

	<footer class="footer">
	<div class="footer-content">
		
	      <div class="footer__element">
	<p>Hi there, <br />welcome to my Blog glad you found it. Have a look around, will you?</p>
</div>

	    
	      <div class="footer__element">
	<h5>Check out</h5>
	<ul class="footer-links">
		<li class="footer-links__link"><a href="/archives">Archive</a></li>
		
		  <li class="footer-links__link"><a href="/atom.xml">RSS</a></li>
	    
		<li class="footer-links__link"><a href="/about">about page</a></li>
		<li class="footer-links__link"><a href="/tags">Tags</a></li>
		<li class="footer-links__link"><a href="/categories">Categories</a></li>
	</ul>
</div>

	    

		<div class="footer-credit">
			<span>© 2017 失落的乐章 | Powered by <a href="https://hexo.io/">Hexo</a> | Theme <a href="https://github.com/HoverBaum/meilidu-hexo">MeiliDu</a></span>
		</div>

	</div>


</footer>



</body>

</html>
